package example;

import constants.*;
import java.util.Arrays;
import java.util.List;
import model.Charge;
import model.Common;
import model.DeviceState;
import model.Info;
import model.OnlineLog;
import model.Renew;
import sdk.ChargeSDK;
import sdk.Client;
import sdk.DeviceLogSDK;
import sdk.DeviceStateSDK;
import sdk.InfoSDK;
import sdk.RenewSDK;

public class Main {
    public static void main(String[] args) {
        String appId = "请联系万桩工作人员获取";
        String appSecret = "请联系万桩工作人员获取";
        String baseUrl = "请联系万桩工作人员获取";
        String deviceNum = "请联系万桩工作人员获取";
        String tradeNo = "请联系万桩工作人员获取";
        List<String> deviceNums = Arrays.asList(deviceNum);
        int chargeMode = Constants.ChargeMode.ChargeModeStandardEnergyMode;


        Client client = new Client(appId, appSecret, baseUrl);

        InfoSDK infoClient = new InfoSDK(client);

        Object res = infoClient.getDeviceSettingOnlineCardInfo(new Info.GetDeviceSettingOnlineCardInfoReq(deviceNum));
        System.out.println("get_device_setting_online_card_info   =====> " + res);

        res = infoClient.getDeviceModeTimeInfo(new Info.GetDeviceModeTimeInfoReq(deviceNum));
        System.out.println("get_device_mode_time_info   =====> " + res);

        res = infoClient.getDeviceModeTime1Info(new Info.GetDeviceModeTime1InfoReq(deviceNum));
        System.out.println("get_device_mode_time1_info   =====> " + res);

        res = infoClient.getDeviceSettingCoinInfo(new Info.GetDeviceSettingCoinInfoReq(deviceNum));
        System.out.println("get_device_setting_coin_info   =====> " + res);

        res = infoClient.deviceSaveMode(new Info.DeviceSaveModeReq(deviceNum, chargeMode, 100,deviceNums, 0,0, 100, Arrays.asList(10, 20), Arrays.asList(10, 20), 1, 10, Arrays.asList(20, 30), Arrays.asList(40, 50), 10, 10, 1, 1, "", "", "", "",0,0,0, 10,"",0,0,0,0));
        System.out.println("device_save_mode   =====> " + res);

        // ...

        ChargeSDK chargeClient = new ChargeSDK(client);

        res = chargeClient.chargeStart(new Charge.ChargeStart(deviceNum, "1", 10033, chargeMode, 100));
        System.out.println("charge_start   =====> " + res);

        res = chargeClient.chargeStop(new Charge.ChargeStop(deviceNum, "1", 10033));
        System.out.println("charge_stop   =====> " + res);

        
        DeviceLogSDK deviceLogClient = new DeviceLogSDK(client);

        res = deviceLogClient.onlineLog(new OnlineLog.OnlineLogReq(deviceNum, new Common.PageModel(1, 10)));
        System.out.println("online_log   =====> " + res);

        RenewSDK renewClient = new RenewSDK(client);

        res = renewClient.createCompanyRenewOrder(new Renew.CreateCompanyRenewOrderReq(deviceNums, tradeNo));
        System.out.println("create_company_renew_order   =====> " + res);

        res = renewClient.getCompanyExpireDeviceList(new Renew.GetCompanyExpireDeviceListReq(new Common.PageModel(1, 10)));
        System.out.println("get_company_expire_device_list   =====> " + res);

        res = renewClient.getCompanyRenewStatus(new Renew.GetCompanyRenewStatusReq(tradeNo));
        System.out.println("get_company_renew_status   =====> " + res);


        DeviceStateSDK deviceStateClient = new DeviceStateSDK(client);

        int rtp = Constants.RestartType.RestartTypeModule;
        res = deviceStateClient.deviceStateRestart(new DeviceState.DeviceStateRestart(deviceNums, rtp));
        System.out.println("device_state_restart   =====> " + res);

        res = deviceStateClient.deviceStateOffline(new DeviceState.DeviceStateOffline(deviceNums));
        System.out.println("device_state_offline   =====> " + res);

        res = deviceStateClient.deviceStateOfflineProfit(new DeviceState.DeviceStateOfflineProfit(deviceNums, "0", "0"));
        System.out.println("device_state_offline_profit   =====> " + res);

        int iserrType = Constants.IsErrorType.IsErrorTypeOK;
        res = deviceStateClient.deviceStatePortError(new DeviceState.DeviceStatePortError(deviceNums, 0, iserrType));
        System.out.println("device_state_port_error   =====> " + res);

        res = deviceStateClient.deviceState(new DeviceState.DeviceStateReq(deviceNum, Arrays.asList("state", "eq_used")));
        System.out.println("device_state   =====> " + res);
    }
}